package cn.momoshenchi.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version : 1.0
 * @author: momoshenchi
 * @date: 2021/6/6 - 11:37
 */
@Configuration
public class RabbitMqConfig {
    @Bean
    public Queue queueMessage() {
        return new Queue("student.a");
    }

    @Bean
    public Queue queueMessages() {
        return new Queue("student.b");
    }

    @Bean
    FanoutExchange exchange() {
        return new FanoutExchange("MyExchange");
    }

    @Bean
    Binding bindingExchangeMessage(Queue queueMessage, FanoutExchange exchange) {
        return BindingBuilder.bind(queueMessage).to(exchange);
    }

    @Bean
    Binding bindingExchangeMessages(Queue queueMessages, FanoutExchange exchange) {
        return BindingBuilder.bind(queueMessages).to(exchange);
    }
}
